package com.qf;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;

/**
 * description:
 * author: Ken
 * 公众号：Java架构栈
 */
@WebListener
public class SessionDataListener implements HttpSessionAttributeListener {

    @Override
    public void attributeAdded(HttpSessionBindingEvent httpSessionBindingEvent) {
//        System.out.println("session添加了属性：" + httpSessionBindingEvent.getName() + " " + httpSessionBindingEvent.getValue());

    }

    @Override
    public void attributeRemoved(HttpSessionBindingEvent httpSessionBindingEvent) {

    }

    @Override
    public void attributeReplaced(HttpSessionBindingEvent httpSessionBindingEvent) {
//        System.out.println("session替换了属性：" + httpSessionBindingEvent.getName() +
//                " " + httpSessionBindingEvent.getValue() + " 替换后:" + httpSessionBindingEvent.getSession().getAttribute(httpSessionBindingEvent.getName()));
    }
}
